<!DOCTYPE html>
<html lang="en">
  <head>
    <title>ClassBasedOnClickListener Structure Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset="utf-8">
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
    <script src="../js/lunr.min.js" defer></script>
    <script src="../js/typeahead.jquery.js" defer></script>
    <script src="../js/jazzy.search.js" defer></script>
  </head>
  <body>

    <a name="//apple_ref/swift/Struct/ClassBasedOnClickListener" class="dashAnchor"></a>

    <a title="ClassBasedOnClickListener Structure Reference"></a>

    <header class="header">
      <p class="header-col header-col--primary">
        <a class="header-link" href="../index.html">
          FolioReaderKit Docs
        </a>
        
      </p>
    
      <p class="header-col--secondary">
        <form role="search" action="../search.json">
          <input type="text" placeholder="Search documentation" data-typeahead>
        </form>
      </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="https://github.com/FolioReader/FolioReaderKit">
            <img class="header-icon" src="../img/gh.png"/>
            View on GitHub
          </a>
        </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="dash-feed://https%3A%2F%2FfolioReader%2Egithub%2Eio%2FFolioReaderKit%2Fdocsets%2FFolioReaderKit%2Exml">
            <img class="header-icon" src="../img/dash.png"/>
            Install in Dash
          </a>
        </p>
    </header>

    <p class="breadcrumbs">
      <a class="breadcrumb" href="../index.html">FolioReaderKit Reference</a>
      <img class="carat" src="../img/carat.png" />
      ClassBasedOnClickListener Structure Reference
    </p>

    <div class="content-wrapper">
      <nav class="navigation">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FRBook.html">FRBook</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FRResource.html">FRResource</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes.html#/c:@M@FolioReaderKit@objc(cs)FRResources">FRResources</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FRTocReference.html">FRTocReference</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReader.html">FolioReader</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderAudioPlayer.html">FolioReaderAudioPlayer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderCenter.html">FolioReaderCenter</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderConfig.html">FolioReaderConfig</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderContainer.html">FolioReaderContainer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderPage.html">FolioReaderPage</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/FolioReaderWebView.html">FolioReaderWebView</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/Highlight.html">Highlight</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/Highlight.html#/s:14FolioReaderKit9HighlightC08MatchingD0V">– MatchingHighlight</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/FolioReaderError.html">FolioReaderError</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/FolioReaderFont.html">FolioReaderFont</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/FolioReaderFontSize.html">FolioReaderFontSize</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/FolioReaderScrollDirection.html">FolioReaderScrollDirection</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HighlightStyle.html">HighlightStyle</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/MediaOverlayStyle.html">MediaOverlayStyle</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/UIAlertController.html">UIAlertController</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/FolioReaderCenterDelegate.html">FolioReaderCenterDelegate</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/FolioReaderDelegate.html">FolioReaderDelegate</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/FolioReaderPageDelegate.html">FolioReaderPageDelegate</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/ClassBasedOnClickListener.html">ClassBasedOnClickListener</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/MediaType.html">MediaType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/QuoteImage.html">QuoteImage</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">

        <section class="section">
          <div class="section-content">
            <h1>ClassBasedOnClickListener</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ClassBasedOnClickListener</span></code></pre>

                </div>
              </div>
            <p>A <code>ClassBasedOnClickListener</code> takes a closure which is performed if a given html <code>class</code> is clicked. The closure will reveice the content of the specified parameter.</p>

<p>Eg. A ClassBasedOnClickListener with the className <code>quote</code> and parameterName <code>id</code> with the given epub html content <code>&lt;section class=&quot;quote&quot; id=&quot;12345&quot;&gt;</code> would call the given closure on a click on this section with the String <code>12345</code> as parameter.</p>

          </div>
        </section>

        <section class="section">
          <div class="section-content">
            <div class="task-group">
              <ul class="item-container">
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV10schemeNameSSvp"></a>
                    <a name="//apple_ref/swift/Property/schemeName" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV10schemeNameSSvp">schemeName</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The name of the URL scheme which should be used. Note: Make sure that the given <code>String</code> is a valid as scheme name.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">schemeName</span><span class="p">:</span> <span class="kt">String</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV13querySelectorSSvp"></a>
                    <a name="//apple_ref/swift/Property/querySelector" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV13querySelectorSSvp">querySelector</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The query selector for the elements which the listener should be added to. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector">https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector</a> for further information about query selectors.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">querySelector</span><span class="p">:</span> <span class="kt">String</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV13attributeNameSSvp"></a>
                    <a name="//apple_ref/swift/Property/attributeName" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV13attributeNameSSvp">attributeName</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The name of the attribute whose content should be passed to the <code><a href="../Structs/ClassBasedOnClickListener.html#/s:14FolioReaderKit25ClassBasedOnClickListenerV02onG6ActionyySSSg_So7CGPointVtcvp">onClickAction</a></code> action.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">attributeName</span><span class="p">:</span> <span class="kt">String</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV9selectAllSbvp"></a>
                    <a name="//apple_ref/swift/Property/selectAll" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV9selectAllSbvp">selectAll</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Whether the listener should be added to all found elements or only to the first one. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll">https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll</a> for further information. The default value is <code>true</code>.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">selectAll</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV02onG6ActionyySSSg_So7CGPointVtcvp"></a>
                    <a name="//apple_ref/swift/Property/onClickAction" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV02onG6ActionyySSSg_So7CGPointVtcvp">onClickAction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The closure which will be called if the specified class was clicked. <code>attributeContent</code> contains the string content of the specified attribute and <code>touchPointRelativeToWebView</code> reprsents the touch point relative to the web view.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onClickAction</span><span class="p">:</span> <span class="p">((</span><span class="n">_</span> <span class="nv">attributeContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">_</span> <span class="nv">touchPointRelativeToWebView</span><span class="p">:</span> <span class="kt">CGPoint</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14FolioReaderKit25ClassBasedOnClickListenerV10schemeName13querySelector09attributeJ09selectAll02onG6ActionACSS_S2SSbySSSg_So7CGPointVtctcfc"></a>
                    <a name="//apple_ref/swift/Method/init(schemeName:querySelector:attributeName:selectAll:onClickAction:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:14FolioReaderKit25ClassBasedOnClickListenerV10schemeName13querySelector09attributeJ09selectAll02onG6ActionACSS_S2SSbySSSg_So7CGPointVtctcfc">init(schemeName:querySelector:attributeName:selectAll:onClickAction:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initializes a <code>ClassBasedOnClickListener</code> instance. Append it to the <code>classBasedOnClickListeners</code> property from the <code><a href="../Classes/FolioReaderConfig.html">FolioReaderConfig</a></code> to receive on click events. The default <code><a href="../Structs/ClassBasedOnClickListener.html#/s:14FolioReaderKit25ClassBasedOnClickListenerV9selectAllSbvp">selectAll</a></code> value is <code>true</code>.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">schemeName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">querySelector</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">attributeName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">selectAll</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">onClickAction</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">((</span><span class="n">_</span> <span class="nv">attributeContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">_</span> <span class="nv">touchPointRelativeToWebView</span><span class="p">:</span> <span class="kt">CGPoint</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">))</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>schemeName</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The name of the URL scheme which should be used. Note: Make sure that the given <code>String</code> is a valid as scheme name.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>querySelector</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The query selector for the elements which the listener should be added to. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector">https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector</a> for further information about query selectors.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>attributeName</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The name of the attribute whose content should be passed to the <code><a href="../Structs/ClassBasedOnClickListener.html#/s:14FolioReaderKit25ClassBasedOnClickListenerV02onG6ActionyySSSg_So7CGPointVtcvp">onClickAction</a></code> action.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>selectAll</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Whether the listener should be added to all found elements or only to the first one. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll">https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll</a> for further information. The default value is <code>true</code>.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>onClickAction</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure which will be called if the specified class was clicked. <code>attributeContent</code> contains the string content of the specified attribute and <code>touchPointRelativeToWebView</code> reprsents the touch point relative to the web view.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </section>

      </article>
    </div>
    <section class="footer">
      <p>&copy; 2019 <a class="link" href="https://twitter.com/hebertialmeida" target="_blank" rel="external">Heberti Almeida</a>. All rights reserved. (Last updated: 2019-02-21)</p>
      <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
    </section>
  </body>
</div>
</html>
